<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Asynchrony (computer programming)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Asynchrony_(computer_programming)"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Asynchrony_computer_programming rootpage-Asynchrony_computer_programming skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Asynchrony (computer programming)</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p><b>Asynchrony</b>, in <a href="Computer_programming" title="Computer programming">computer programming</a>, refers to the occurrence of events independent of the main <a href="Control_flow" title="Control flow">program flow</a> and ways to deal with such events. These may be "outside" events such as the arrival of <a href="Unix_signal" class="mw-redirect" title="Unix signal">signals</a>, or actions instigated by a program that take place <a href="Concurrent_computing" title="Concurrent computing">concurrently</a> with program execution, without the program <a href="Hang_(computing)" title="Hang (computing)">hanging</a> to wait for results.<sup id="cite_ref-davies_1-0" class="reference"><a href="#cite_note-davies-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> <a href="Asynchronous_I/O" title="Asynchronous I/O">Asynchronous input/output</a> is an example of the latter case of asynchrony, and lets programs issue commands to storage or network devices that service these requests while the <a href="Central_processing_unit" title="Central processing unit">processor</a> continues executing the program. Doing so provides a degree of <a href="Concurrency_(computer_science)" title="Concurrency (computer science)">concurrency</a>.<sup id="cite_ref-davies_1-1" class="reference"><a href="#cite_note-davies-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p><p>A common way for dealing with asynchrony in a <a href="Application_programming_interface" class="mw-redirect" title="Application programming interface">programming interface</a> is to provide <a href="Subroutine" class="mw-redirect" title="Subroutine">subroutines</a> that return a <a href="Futures_and_promises" title="Futures and promises">future or promise</a> that represents the ongoing operation, and a synchronizing operation that <a href="Blocking_(computing)" title="Blocking (computing)">blocks</a> until the future or promise is completed. Some programming languages, such as <a href="Cilk" title="Cilk">Cilk</a>, have special syntax for expressing an asynchronous procedure call.<sup id="cite_ref-spp_2-0" class="reference"><a href="#cite_note-spp-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>Examples of asynchrony include the following:
</p>
<ul><li><a href="Asynchronous_procedure_call" title="Asynchronous procedure call">Asynchronous procedure call</a>, a method to run a procedure concurrently, a lightweight alternative to <a href="Thread_(computing)" title="Thread (computing)">threads</a>.</li>
<li><a href="Ajax_(programming)" title="Ajax (programming)">Ajax</a> is a set of <a href="Client-side" class="mw-redirect" title="Client-side">client-side</a> <a href="Web_development" title="Web development">web technologies</a> used by the client to create asynchronous I/O <a href="Web_application" title="Web application">web applications</a>.</li>
<li><b>Asynchronous method dispatch</b> (AMD), a <a href="Data_communication" title="Data communication">data communication</a> method used when there is a need for the server side to handle a large number of long lasting client requests.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> Using synchronous method dispatch (SMD), this scenario may turn the server into an unavailable busy state resulting in a connection failure response caused by a <a href="Computer_network" title="Computer network">network</a> connection request <a href="Timeout_(computing)" title="Timeout (computing)">timeout</a>. The servicing of a client request is immediately dispatched to an available <a href="Thread_(computer_science)" class="mw-redirect" title="Thread (computer science)">thread</a> from a <a href="Thread_pool_pattern" class="mw-redirect" title="Thread pool pattern">pool of threads</a> and the client is put in a blocking state. Upon the completion of the task, the server is notified by a callback. The server unblocks the client and transmits the response back to the client. In case of thread <a href="Starvation_(computer_science)" title="Starvation (computer science)">starvation</a>, clients are blocked waiting for threads to become available.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1266661725">
/* start https://en.wikipedia.org/ */
.mw-parser-output .portalbox{padding:0;margin:0.5em 0;display:table;box-sizing:border-box;max-width:175px;list-style:none}.mw-parser-output .portalborder{border:1px solid var(--border-color-base,#a2a9b1);padding:0.1em;background:var(--background-color-neutral-subtle,#f8f9fa)}.mw-parser-output .portalbox-entry{display:table-row;font-size:85%;line-height:110%;height:1.9em;font-style:italic;font-weight:bold}.mw-parser-output .portalbox-image{display:table-cell;padding:0.2em;vertical-align:middle;text-align:center}.mw-parser-output .portalbox-link{display:table-cell;padding:0.2em 0.2em 0.2em 0.3em;vertical-align:middle}@media(min-width:720px){.mw-parser-output .portalleft{margin:0.5em 1em 0.5em 0}.mw-parser-output .portalright{clear:right;float:right;margin:0.5em 0 0.5em 1em}}
/* end https://en.wikipedia.org/ */
</style>
<ul><li><a href="Asynchronous_system" title="Asynchronous system">Asynchronous system</a></li>
<li><a href="Asynchronous_circuit" title="Asynchronous circuit">Asynchronous circuit</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-davies-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-davies_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-davies_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFDavies2012" class="citation book cs1">Davies, Alex (2012). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=xT45qhFrVnUC"><i>Async in C# 5.0</i></a>. O'Reilly. pp. <span class="nowrap">1–</span>2. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>9781449337124</bdi>.</cite></span>
</li>
<li id="cite_note-spp-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-spp_2-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFMcCoolReindersRobison2013" class="citation book cs1">McCool, Michael; Reinders, James; Robison, Arch (2013). <i>Structured Parallel Programming: Patterns for Efficient Computation</i>. Elsevier. p. 30.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20130721031512/http://zeroc.com/doc/Ice-3.3.0/manual/Overview.3.2.html">ICE usage of AMD</a>.</span>
</li>
</ol></div></div>
<p><br>
</p>
<style data-mw-deduplicate="TemplateStyles:r1271159938">
/* start https://en.wikipedia.org/ */
.mw-parser-output .asbox{position:relative;overflow:hidden}.mw-parser-output .asbox table{background:transparent}.mw-parser-output .asbox p{margin:0}.mw-parser-output .asbox p+p{margin-top:0.25em}.mw-parser-output .asbox-body{font-style:italic}.mw-parser-output .asbox-note{font-size:smaller}.mw-parser-output .asbox .navbar{position:absolute;top:-0.75em;right:1em;display:none}.mw-parser-output :not(p):not(.asbox)+style+.asbox,.mw-parser-output :not(p):not(.asbox)+link+.asbox{margin-top:3em}
/* end https://en.wikipedia.org/ */
</style>
</div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-04-30" href="https://en.wikipedia.org/wiki/?title=Asynchrony_(computer_programming)&oldid=1288110412">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>